DevForce Help Reference
DelegateVerifier<T> Class
Members  Example 


the Type of object being verified
A programmatically-created verifier with custom verification and applicability logic.
Object Model
DelegateVerifier<T> ClassVerifierErrorMessageInfo ClassVerifierArgs ClassVerifierEngine ClassVerifierOptions Class
Syntax
'Declaration
 
Public Class DelegateVerifier(Of T As Class) 
   Inherits Verifier(Of T)
   Implements System.IComparable(Of Verifier) 
'Usage
 
Dim instance As DelegateVerifier(Of T)
public class DelegateVerifier<T> : Verifier<T>, System.IComparable<Verifier>  
where T: class
Type Parameters
T
the Type of object being verified
Remarks
A DelegateVerifier allows you to programmatically build a verifier. These verifiers will be discovered if returned from an IVerifierProvider implementation. You can also add the verifier directly to the engine using VerifierEngine.AddVerifier.
Example
private DelegateVerifier SampleDelegateVerifier() {
  // A simple example adding a delegate verifier to ensure that Employee
  // BirthDate falls before HireDate.

  // Apply verifier only when have data for both properties.
  ApplicabilityConstraint<Employee> constraint = (emp, trigger, context) => {
    return emp.HireDate.HasValue && emp.BirthDate.HasValue ?
      VerifierApplicability.Yes : VerifierApplicability.InsufficientData;
  };

  // Define the verification performed - BirthDate must precede HireDate
  VerifierCondition<Employee> condition = (emp, trigger, context) => {
    return new VerifierResult(emp.BirthDate < emp.HireDate);
  };

  var errorMessage = "Must be born before hired";

  // Create the verifier.  Execute only after set and on instance.
  var v = new DelegateVerifier<Employee>(errorMessage, constraint, condition);
  v.VerifierOptions.ExecutionModes = VerifierExecutionModes.InstanceAndOnAfterSetTriggers;

  // Add triggers - setters for HireDate and BirthDate properties will trigger.
  v.AddTriggers(Employee.PropertyMetadata.HireDate.Name, Employee.PropertyMetadata.BirthDate.Name);

  return v;
}
Inheritance Hierarchy

System.Object
   IdeaBlade.Validation.Verifier
      IdeaBlade.Validation.Verifier<T>
         IdeaBlade.Validation.DelegateVerifier<T>

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DelegateVerifier<T> Members
IdeaBlade.Validation Namespace

Send Feedback